<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>axios基本使用 </title>
</head>

<body>

  <input type="button" value="get 请求" class="get">
  <input type="button" value="post 请求" class="post">

  <!-- <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script> -->
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

  <script>

    document.querySelector(".get").onclick = function () {
      axios.get("http://127.0.0.1:8080/hello111?name=lisi")
        .then(function (response) {
          console.log(response.data);
        }, function (err) {
          console.log(err);
        }
        )
    }

    document.querySelector(".post").onclick = function () {
      axios.post("http://127.0.0.1:8080/addUser", { name: "李三", age: 18 })
        .then(function (response) {
          console.log(response.data);
        }), function (err) {
          console.log(err);
        }
    }








  </script>
</body>


</html>